package com.smart.framework.util;

import java.io.FileInputStream;
import java.util.Properties;

/**
 * <p><b>Description:</b>  TODO
 * <p><b>Company:</b>
 *
 * @author created by Jesse Xu at 9:55 on 2019/9/23
 * @version V0.1
 * @classNmae PropsUtil
 */
public class PropsUtil {
    public static Properties loadProps(String configFile) {
        Properties properties = new Properties();
        FileInputStream fis = null;
        try {
            fis = new FileInputStream(configFile);
            properties.load(fis);
        } catch (java.io.IOException e) {
            e.printStackTrace();
        }
        return properties;
    }

    public static String getString(Properties configProps, String name) {
       return configProps.getProperty(name);
    }

    public static String getString(Properties configProps, String name,String defaultValue) {
        return configProps.getProperty(name)==null?defaultValue:configProps.getProperty(name);
    }
}
